﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using ApiConceptsFramework.Contract;
using ApiConceptsFramework.FluentApi;
using NUnit.Framework;

namespace test.ApiConceptsFramework.FluentApi.Scenarios.OtherStudies
{
	[TestFixture, Explicit]
	class ConstructorVsFactory
	{
		private Assembly[] _assemblies;
		private string[] _usings;
		private ApiEvaluator _eval;

		#region Setup
		[SetUp]
		public void SetUp()
		{
			_assemblies = new Assembly[] { this.GetType().Assembly };
			_usings = new string[] {};

			_eval = new ApiEvaluator(_assemblies);
			_eval.IDE = IDE.EclipseOrSimilar;
			_eval.SetUsings(_usings);
			_eval.SetAssemblyRefs(_assemblies);
		}

		[TearDown]
		public void TearDown()
		{
			_eval.EvaluateAndPrintToConsole();
		}
		#endregion


		[Test]
		public void SocketsTask_MulticastSocket()
		{
			//_eval.ClassUsage<MulticastSocket>();
			_eval.Instantiation(() => new MulticastSocket(0));
			_eval.MethodCall((MulticastSocket m) => m.joinGroup(null));
		}

		[Test]
		public void SocketsTask_SSLSocket()
		{
			//_eval.ClassUsage<SSLSocketFactory>();
			//_eval.ClassUsage<SSLSocket>();
			_eval.MethodCall((SSLSocketFactory f) => SSLSocketFactory.getDefault());
			_eval.MethodCall((SSLSocketFactory f) => f.createSocket(null, 0));
		}
		
		class MulticastSocket
		{
			public MulticastSocket()
			{}
			public MulticastSocket(int port)
			{ }
			public MulticastSocket(string otherOverload)
			{ }

			public void joinGroup(string address)
			{ }
			public void joinGroup(string address, bool otherOverload)
			{ }

			public void otherMethod1() { }
			public void otherMethod2() { }
			public void otherMethod3() { }
			public void otherMethod4() { }
			public void otherMethod5() { }
			public void otherMethod6() { }
			public void otherMethod7() { }
			public void otherMethod8() { }
			public void otherMethod9() { }
			public void otherMethod10() { }
			public void otherMethod11() { }
			public void otherMethod12() { }
			public void otherMethod13() { }
			public void otherMethod14() { }
			public void otherMethod15() { }
			public void otherMethod16() { }
			public void otherMethod17() { }
			public void otherMethod18() { }
			public void otherMethod19() { }
			public void otherMethod20() { }
			public void otherMethod21() { }
			public void otherMethod22() { }
			public void otherMethod23() { }
			public void otherMethod24() { }
			public void otherMethod25() { }
			public void otherMethod26() { }
			public void otherMethod27() { }
			public void otherMethod28() { }
			public void otherMethod29() { }
			public void otherMethod30() { }
		}

		class SSLSocketFactory
		{
			public static SSLSocketFactory getDefault()
			{
				return null;
			}

			public SSLSocket createSocket()
			{
				return null;
			}

			public SSLSocket createSocket(string addr, int port)
			{
				return null;
			}

			public void otherMethod1() { }
			public void otherMethod2() { }
			public void otherMethod3() { }
			public void otherMethod4() { }
			public void otherMethod5() { }
			public void otherMethod6() { }
			public void otherMethod7() { }
			public void otherMethod8() { }
			public void otherMethod9() { }
			public void otherMethod10() { }
			public void otherMethod11() { }
			public void otherMethod12() { }
			public void otherMethod13() { }
			public void otherMethod14() { }
			public void otherMethod15() { }
			public void otherMethod16() { }
			public void otherMethod17() { }
			public void otherMethod18() { }
			public void otherMethod19() { }
			public void otherMethod20() { }
		}

		class SSLSocket
		{}
	}
}
